﻿using fmtx.Framework.DALFactory;
using fmtx.Framework.Web;
using SYH.IWebBLL;
using SYH.Web.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SYH.Web.Controllers.Views
{
    public class VHomeController : Controller
    {
        private string BasePath = System.Web.HttpContext.Current.Request.ApplicationPath;

        public VHomeController()
        {
            BasePath = (BasePath.Length == 1 ? "" : (BasePath + "/"));
        }

        // GET: VHome
        /// <summary>
        /// 默认页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var user = LoginService.LogUser;
            if (user == null)
            {
                return Redirect(BasePath + "/Login.html");
            }
            else
            {
                return View();
            }
        }

        /// <summary>
        /// 退出登录
        /// </summary>
        /// <returns></returns>
        public ActionResult LoginOut()
        {
            LoginService.SetOut();
            return Redirect(BasePath + "/Login.html");
        }
    }
}